<?php

namespace IDock\Insurance\AICS\Request;

use Exception;
use IDock\Insurance\AICS\Request\AllAICSRequest;
use IDock\Insurance\AICS\Response\ProposalStatusResponse;
use IDock\Insurance\AICS\Response\PolicyInfoResponse;
use IDock\Visitor\PolicyInfoVisitor;
use IDock\Visitor\ProposalStatusVisitor;

class ProposalStatusRequest extends AllAICSRequest
{
    /**
     * @var  ProposalStatusVisitor $visitor
     */
    protected $visitor;

    public $code = 'payCallback';

    public $envelopeName = 'new:thirdPartycallBack';

    protected $response = PolicyInfoResponse::class;

    protected $urlTip = '保单详情查询';

    public $userName = '';

    /**
     * @return array
     */
    public function generate(): array
    {
        if(empty($this->visitor->inquiryNo)){
            throw new Exception("订单号不能为空");
        }
        return [
            'ordercode' => $this->visitor->inquiryNo,
            'type' => '5',
            'creator' => $this->userName,
        ];
    }
}
